clear all;
close all;
clc;

alpha_f = deg2rad(50);
beta_f = deg2rad(0);

alpha_s = deg2rad(-90:5:90);
beta_s = deg2rad(-180:5:180);

beta = h(alpha_f, beta_f);
F = nan(length(alpha_s), length(beta_s));
for a = 1:length(alpha_s)
    for b = 1:length(beta_s)
        S = 1;
        y = h(alpha_s(a), beta_s(b)) * S;
        U = beta' * y;
        F(a, b) = abs(U / S)^2;
    end
end

%figure;
%surf(alpha_s, beta_s, F);

[alpha_sm, beta_sm] = meshgrid(alpha_s, beta_s);
[Fx, Fy, Fz] = sph2cart(beta_sm, alpha_sm, F.');
figure;
surf(Fx, Fy, Fz);
